package com.example.demo.dao;

import com.example.demo.Student;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Select;

import javax.smartcardio.Card;
import java.util.List;

@Mapper
public interface StuMapper {

    @Select("select * from tb_student where name like concat('%',#{name},'%')")
    List<Student> getStuByName(String name);
    //查询到学号之后，把参数传递到getCardByNo方法中继续查询学生卡的信息，并且返回值存放到参数card中通
    @Result(property = "card",column = "no",one = @One(select = "com.rgzn.chapter3_3.mapper.StuMapper.getCardByNo"))
    @Select("select * from tb_student where qq =#{qq}")
    List<Student> getStuByQQ(String qq);

    @Select("select * from card where cardNo = #{no}")
    Card getCardByNo(String no);
}